from django.conf.urls.defaults import *
from django.contrib.auth.views import login, logout
from django.contrib import admin
from django.contrib.auth.models import User
from django.contrib.auth.views import password_change, password_change_done

admin.autodiscover()

urlpatterns = patterns('',

    # dev
    (r'^static/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': '/home/kreved/soft-svn/nstat/v2/nstat/static/'}),

    # main
    url(r'^$', 'nstat.traffic.views.root', {}, 'root'),

    url(r'^stat$', 'nstat.traffic.views.root', {}),

    url(r'^scripts/stat$', 'nstat.traffic.views.root', {}),

    url(r'sign$', 'nstat.traffic.views.root', {}),
    
    url(r'^payments/(?P<statuser>\d+)/$', 'nstat.traffic.views.payments', {}, \
                'payments_by_user'),
    
    url(r'^payments/all/$', 'nstat.traffic.views.payments', {}, 'payments'),
    
    url(r'^users/(?P<statuser>\d+)/info/$', \
            'django.views.generic.simple.direct_to_template', \
            {'template': 'info.html'}, "userinfo"),
    
    url(r'^users/list/$', 'nstat.traffic.views.users', {}, 'user_list'),
    
    url(r'^pay/(?P<statuser>\d+)/$', 'nstat.traffic.views.pay', {}, 'pay'),

    url(r'^change_tariff/(?P<statuser>\d+)/$',
            'nstat.traffic.views.change_tariff', {}, 'change_tariff'),

    url(r'^turn_inet/(?P<statuser>\d+)/on/$',
            'nstat.traffic.views.turn_inet', {"status": True}, 'inet_on'),

    url(r'^turn_inet/(?P<statuser>\d+)/off/$',
            'nstat.traffic.views.turn_inet', {"status": False}, 'inet_off'),

    url(r'^change_channel/(?P<statuser>\d+)/$',
            'nstat.traffic.views.change_channel', {}, 'change_channel'),

    url(r'^stats/(?P<statuser>\d+)/$',
            'nstat.traffic.views.stats', {}, 'stats'),

    url(r'^stats/all/$',
            'nstat.traffic.views.stats', {}, 'stats'),

    url(r'^help/$', 'nstat.traffic.views.help', {}, "help"),

    url(r'.*scripts/api$', 'nstat.traffic.views.api', {}, 'api'),

    # django
    ('^admin/(.*)', admin.site.root),
    (r'^accounts/login/$',  login, {'template_name': 'login.html'}),
    (r'^accounts/logout/$', logout, {'next_page': '/'}),
    (r'^accounts/password_change/$', "nstat.traffic.views.password_change"),
    (r'^accounts/password_change_done/$', password_change_done, \
            {'template_name': 'password_change_done.html'}),
)
